package com.jaylli.ai.controller;

import io.modelcontextprotocol.client.McpClient;
import jakarta.annotation.Resource;
import org.springframework.ai.chat.client.ChatClient;
import org.springframework.ai.tool.ToolCallbackProvider;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class AiMcpClientController {

    @Resource
    private ToolCallbackProvider tools;

    @Resource
    private ChatClient.Builder chatClientBuilder;

//    @Resource
//    private McpClient mcpClient;


    @GetMapping(value = "ai/mcp/client")
    public String mcpClient(@RequestParam(value = "message", defaultValue = "讲个笑话") String message) {
        ChatClient chatClient = chatClientBuilder.defaultTools(tools).build();
        return chatClient.prompt().user(message).call().content();
    }


}
